const path = require("path");

const resolve = dir => {
    return path.join(__dirname, dir);
};
module.exports = {
    publicPath: process.env.NODE_ENV === "production" ? "/srms/" : "/", //srms应用被部署的子路径 需与nginx里配置一致
    // outputDir: "dist",
    // assetsDir: "static",
    // indexPath: "index.html",
    // filenameHashing: false,
    lintOnSave: false,
    chainWebpack: config => {
        config.resolve.alias
            .set("@", resolve("src")) // key,value自行定义，比如.set('@@', resolve('src/components'))
            .set("_c", resolve("src/components"));
    },
    // 打包时不生成.map文件
    productionSourceMap: false,

    // CSS 相关选项
    css: {
        extract: true,
        sourceMap: false,
        loaderOptions: {
            css: {},
            less: {
                javascriptEnabled: true,
            }
        },
        modules: false,

    },
    devServer: {
        host: 'localhost',
        port: 1024,
        open: true, //配置自动启动浏览器
        proxy: {
            '/systemApi': {
                target: 'http://localhost:1024', // 测试环境
                ws: false,
                changeOrigin: false,
                // pathRewrite: {
                //     '^/systemApi': '/systemApi'
                // }
            }
        }
    }
};